#define _CRT_SECURE_NO_WARNINGS
#include"string.h"

namespace My_String
{
	//string::string()
	//{
	//	_str = new char[1] {'\0'};
	//	_size = 0;
	//	_capacity = 0;
	//}
	string::iterator string::begin()
	{
		return _str;
	}
	string::iterator string::end()
	{
		return _str + _size;
	}

	string::string(const char* str)
		:_size(strlen(str))
	{
		_str = new char[_size + 1];
		_capacity = _size;
		strcpy(_str, str);
	}
	string::~string()
	{
		delete[] _str;
		_str = nullptr;
		_size = _capacity = 0;
	}
	const char* string::c_str() const
	{
		return _str;
	}
	size_t string::size()const
	{
		return _size;
	}
	char& string::operator[](size_t pos)
	{
		assert(pos < _size);
		return _str[pos];
	}

}